/*
 * GeoState.h
 *
 *  Created on: 14 Oct 2011
 *      Author: allan
 */

#ifndef GEOSTATE_H_
#define GEOSTATE_H_

// C++ includes
#include <string>
#include <iostream>
using namespace std;

// Eigen includes
#include <Eigen/Core>
using namespace Eigen;

#include "Geochemistry/GeoSystem.h"

class GeoState
{
public:
	GeoState(const GeoSystem& geosystem);

	void SetTemperature(double T);

	void SetPressure(double P);

	void SetComposition(const VectorXd& n);

	void SetComposition(const string& species, double val);

	const double GetTemperature() const;

	const double GetPressure() const;

	const VectorXd& GetComposition() const;

	const VectorXd GetPhaseComposition(const string& phasename) const;

	const double Get(const string& quantity) const;

	const double Get(const string& quantity, const string& species) const;

	friend ostream& operator<<(ostream& out, const GeoState& geostate);
	
public:
	/// The instance of the geochemical system.
	const GeoSystem& geosystem;
	
	/// The temperature (T) and pressure (P) of the geochemical system
	double T, P;
	
	/// The composition (n), activity (a), activity coefficient (g) and kinetic reaction rate (r) vectors
	VectorXd n, a, g, r;
	
private:
	void OutputMultiphaseState(ostream& out) const;
	
	void OutputReactionsState(ostream& out) const;
};

#endif /* GEOSTATE_H_ */
